/*
 * @Author: hyq
 * @LastEditors: hyq
 * @Description:
 * @Date: 2023-12-05 12:57:35
 */
// useTheme.js

import { useModifyTheme } from '@/stores/theme'
import { onShow } from '@dcloudio/uni-app'
import { storeToRefs } from 'pinia'

export function useTheme() {
  // 被组合式函数封装和管理的状态
  const theme = useModifyTheme()
  const { themeClass } = storeToRefs(theme)
  const { setNavigationBarColorHandler } = theme
  onShow(() => {
    setNavigationBarColorHandler()
  })

  // 通过返回值暴露所管理的状态
  return {
    themeClass
  }
}
